/**
 * Created by oneminute on 7/17/14.
 */

var lz = require("../lib/utils/modules")();

exports.get = function (_req, _res, _opts, _callback) {
    var user = _req.user;
    if (!user) {
        lz.Logger.warn("/ownneeds: 用户为临时用户。");
        _callback(lz.Config.errors.getError(lz.Config.errors.REQUEST_TEMPUSER_ERROR));
        return;
    }
    var infos = [];
    user.demands.forEach (function(_demand) {
        infos.push(_demand.getInfo(user));
    });
    _callback(null, user, infos);
};
